package pl.edu.agh.neuraleconomy.ui.component;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public abstract class OkCancelDialog extends Dialog {

	public OkCancelDialog(Shell parentShell) {
		super(parentShell);
	}

	@Override
	protected Control createDialogArea(Composite parent) {
		init(parent);
		return parent;
	}
	
	protected abstract void init(Composite parent);

	protected void saveInput() {

	}

	protected boolean validateInput() {
		return true;
	}

	@Override
	protected void okPressed() {
		if (validateInput()) {
			saveInput();
			super.okPressed();
		}
	}
}
